extension :deployment => :local_build do
  task :deploy do
    build
    patch_dist

    dep_root = revision_deployment.deployment_root
    FileUtils.rm_rf dep_root
    FileUtils.mkdir_p File.dirname(dep_root)
    FileUtils.cp_r revision_build.patched_dist_path, dep_root
  end
  
  task :link_deployment do
    syscmd("sh '#{File.join(revision_deployment.deployment_root, link_script_name)}' '#{revision_deployment.deployment_root}'")
  end
  
  task :unlink_deployment do
    syscmd("sh '#{File.join(revision_deployment.deployment_root, unlink_script_name)}'")
  end
  
  task :remove_deployment do
    FileUtils.rm_r revision_deployment.revision_root, :force => true
  end
end
